/*
 * Conversion.java
 *
 * Created on March 29, 2007, 4:58 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package edu.byu.isys413.samlam;

/**
 * conversion
 * @author Adam
 */
public class Conversion extends RevenueSource {
    
    private int quantity;    
    private int numInSet;
    private float total;
    private String status;    
    private String conversionType;
    private double unitPrice;
    private double discount;
    
    
    /**
     * Creates a new instance of Conversion
     * @param id Conversion id
     */
    public Conversion(String id) {
        super(id);
    }

    /**
     * Conversion Description
     * @return conversion
     */
    public String getDescription() {
        return description;
    }

    /**
     * conversion get quantity
     * @return conversion
     */
    public int getQuantity() {
        return quantity;
    }

    /**
     * conversion set quantity
     * @param quantity conversion quantity
     */
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
   

    /**
     * conversion get total
     * @return conversion
     */
    public float getTotal() {
        return total;
    }

    /**
     * conversion set total
     * @param total conversion total
     */
    public void setTotal(float total) {
        this.total = total;
    }

    /**
     * conversion get status
     * @return conversion
     */
    public String getStatus() {
        return status;
    }

    /**
     * conversion set status
     * @param status conversion
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * conversion get conversion
     * @return conversion
     */
    public String getConversionType() {
        return conversionType;
    }

    /**
     * setConversion
     * @param conversionType conversion
     */
    public void setConversionType(String conversionType) {
        this.conversionType = conversionType;
    }
    
    /**
     * calculateDiscount
     * @return conversion
     */
    public double calculateDiscount() {
        double discount = 0;
        if (this.numInSet > 100){
            discount = 1;
        }
        else if (this.numInSet > 200){
            discount = 2;
        }
        return discount;
    }

    /**
     * conversion get number in set
     * @return conversion
     */
    public int getNumInSet() {
        return numInSet;
    }

    /**
     * conversion set number in set
     * @param numInSet conversion
     */
    public void setNumInSet(int numInSet) {
        this.numInSet = numInSet;
    }

    /**
     * get unit price
     * @return unit price
     */
    public double getUnitPrice() {
        return unitPrice;
    }

    /**
     * sets the unit price
     * @param unitPrice price
     */
    public void setUnitPrice(double unitPrice) {
        this.unitPrice = unitPrice;
    }
    
    /**
     * calculates the price of the conversion
     * @return returns a double called price
     */
    public double calculatePrice() {
        double discount = calculateDiscount();
        double totalPrice = this.numInSet * this.unitPrice - discount;
        return totalPrice;
    }

    /**
     * get double discount
     * @return returns double called discount
     */
    public double getDiscount() {
        return discount;
    }

    /**
     * set double called discount
     * @param discount conversion
     */
    public void setDiscount(double discount) {        
        this.discount = discount;
    }
}
